V2EX  ›  英汉词典

Context-Free Grammar

定义 Definition

上下文无关文法(CFG):一种形式文法,用规则来生成语言;其产生式(重写规则)左边只有一个非终结符,因此替换不依赖该符号所处的“上下文”。常用于描述编程语言语法、括号匹配结构,以及自然语言的部分句法现象。(也常简称 CFG

发音 Pronunciation (IPA)

/ˈkɑːntekst friː ˈɡræmər/

例句 Examples

A context-free grammar can describe balanced parentheses.
上下文无关文法可以描述成对匹配的括号结构。

In compiler design, engineers use a context-free grammar to specify the syntax of a programming language before building a parser.
在编译器设计中,工程师会先用上下文无关文法来规定编程语言的语法,再据此构建语法分析器。

词源 Etymology

context-freecontext(上下文)+ free(不受……限制)构成,表示“与上下文无关”;grammar 原指“语法/文法”。该术语在20世纪形式语言与自动机理论发展中被系统化,尤其与乔姆斯基(Noam Chomsky)的文法层级体系密切相关,用来区分不同表达能力的语言描述方式。

相关词 Related Words

文学/著作中的出现 Works

  • Noam Chomsky, Syntactic Structures(《句法结构》)
  • Noam Chomsky, “Three Models for the Description of Language”(语言描述的三种模型)
  • John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman, Introduction to Automata Theory, Languages, and Computation
  • Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Compilers: Principles, Techniques, and Tools(《编译原理》,龙书)
  • Dick Grune, Ceriel J. H. Jacobs, Parsing Techniques: A Practical Guide
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1982 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 03:57 · PVG 11:57 · LAX 19:57 · JFK 22:57
♥ Do have faith in what you're doing.